This page last changed on Sep 08, 2006 by bowens.
LESSON 2: Add a Dataset
Objective:
In this tutorial you will learn how to configure GeoServer to publish with Web Map Service (WMS) and Web Feature Service (WFS) protocols.
Loading and Configuring Data
- Start up GeoServer by going to the Start menu or by running startup.bat in the bin/ directory of your geoserver install.
- Use your web browser and navigate to:
http://localhost:8080/geoserver/welcome.do
Step 1: Log In
- From the welcome page select the Config link located near the top left of the page:
- You will be asked to log in. The default username is admin an default passowrd is geoserver:
- Click Submit. This will take you back to the welcome page.
Step 2: Create a Data Store
- Click on Config again and you will be taken to the main config page.
- Select the Data link:
- Select the Stores link:
You are now in the data store page. Data stores are essentially a location where data lives. It can be a shapefile or database location.
- Select the New link:
- On the 'Create New Data Store' page:
- Select Shapefile from the drop down list labeled DataStore Description.
- Enter the text countries into the text field labeled DataStore ID.
- Hit the New button.
This takes you to the data store editor. Here we need to say where our shapefile is.
- On the DataStore Editor page:
- enter the path of your countries shapeflile (countries.shp).
We have included it in your GeoServer install under (geoserver home)/data_dir/data/countries.shp
- Set the Namespace to topp.
- Leave the Description text area blank.
- Hit Submit.
- On the DataStore Configuration page, click the Apply button located in the upper left hand corner of the page.
Step 3: Create a Feature Type for Your Data
Feature Types are the different sets of data that are in your data location. For a shapefile there will onle be one, but if your DataStore was a database, you might have several data sets to choose from. Each one of these is a Feature Type.
- Head back to the Data Config page:
- Click on the FeatureType link on the Data Configuration page. This will take you to the FeatureType page.
- On the Feature Type page, click on the New button:
- On the Create New FeatureType page:
- From the drop down list select countries::countries
- Click New
- You are now at the FeatureType editor page.
- From the drop down list labeled Style, select polygon. This will determine how your features will be rendered.
- In the text field labeled SRS enter the value 4326. This is the Projection that your dataset is in. In this case, lat/lon.
- Hit the Generate button. This will generate the bounding box of the dataset.
- Now scroll down to the bottom and hit Submit.
- Finally, hit the Apply button on the left of the screen. Then hit the Save button to save all of the changes to disk.
Step 4: Preview Your Data
Lets head over to the Demo page of GeoServer and preview our data.
Open up this URL in your browser:
http://localhost:8080/geoserver/mapPreview.do
Or just navigate to the welcome page, and click on Demo then on Map Preview
Locate your topp:countries layer, then click on the Preview link to the right of it. After a few seconds you should see a your countries dataset!
|